#include "Timer.h"
#include "CheckPingThread.h"
#include "ServerManager.h"

CheckPingThread::CheckPingThread()
{
	m_checkTimer = 0.0f;
}

void CheckPingThread::Work()
{
	MutexLocker ml(&m_mutex);

	while(true)
	{
		TheTimer::Instance()->UpdateTime();
		m_checkTimer += TheTimer::Instance()->GetDt();
		if (m_checkTimer > 5.0f)
		{
			// call server checkmaxping function
			m_checkTimer = 0.0f;
			TheServerManager::Instance()->CheckPing();
		}
	}
}